Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^2: Simpler than XML::Simple

by Jenda (Abbot)
on Nov 22, 2010 at 20:07 UTC ( #873034=note: print w/ replies, xml ) Need Help??


in reply to Re: Simpler than XML::Simple
in thread Simpler than XML::Simple

"Must have an XML schema" ... get real! Yeah, you might have a schema. And the schema migh even be reasonable. Quite often it's not. Ever heard for example of HR-XML? What a ... massive overcomplicated schema. With each company using different parts of the schema. A mess.

There is never "the only solution".

Jenda
Enoch was right!
Enjoy the last years of Rome.


Comment on Re^2: Simpler than XML::Simple
Re^3: Simpler than XML::Simple
by Anonymous Monk on Nov 24, 2010 at 18:30 UTC
    Well, the real world ... my experience is that it's hard to get just well-formed and correctly encoded XML files from external parties.

    Did you know that the "trang" tool is capable of creating a schema out of sample data? So I don't see the advantage with using XML::Smart.

      I don't see the advantage with using XML::Smart either :-)

      Jenda
      Enoch was right!
      Enjoy the last years of Rome.

        Ah, I meant XML::Rules :-)

        I just tried to convert the sample XML from XML::Rules' SYNOPSIS into a schema:

        trang test.xml test.rnc

        And the result:

        default namespace = ""
        
        start =
          element doc {
            element person {
              element fname { xsd:NMTOKEN },
              element lname { xsd:NMTOKEN },
              element email { xsd:NMTOKEN },
              element address {
                element street { xsd:NMTOKEN },
                element city { xsd:NMTOKEN },
                element country { xsd:NMTOKEN },
                element bogus { xsd:NMTOKEN }
              },
              element phones {
                element phone {
                  attribute type { xsd:NCName },
                  xsd:NMTOKEN
                }+
              }
            }+
          }
        
        Which looks quite reasonable. trang can also convert into .xsd files, which look uglier but are needed for XML::Compile operation.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://873034]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (15)
As of 2015-07-02 18:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (44 votes), past polls