Ignoring tags in XML

V

vincente13

Lets say i have a XML element

<command>
system(" $opt = <STDIN> ")
</command>


in my program i actually used the whole string given between <command>
tags to execute the command.

however putting <STDIN> is not allowed in XML..is there any other
alternatives?
 
J

Joe Kesselman

<command>system(" $opt = <STDIN> ")</command>

however putting <STDIN> is not allowed in XML..is there any other
alternatives?

Use &lt; and &gt;, which are the standard XML representations for the <
and > characters. (Or, of course, you can use numeric character
references, < and > respectively.) If you read the file through
any of the standard XML tools, those will be converted to the angle
brackets automagically as part of the parsing process.
 
J

Joe Kesselman

Sorry, I should have said "use &lt; etcetera in text content". That is,

<command>system(" $opt = &lt;STDIN&gt; ")</command>
 
S

Stan R.

Joe said:
Use &lt; and &gt;, which are the standard XML representations for the
< and > characters. (Or, of course, you can use numeric character
references, < and > respectively.) If you read the file
through any of the standard XML tools, those will be converted to the
angle brackets automagically as part of the parsing process.

Could you please tell what the standard XML tools are (name) ? I am
particularly interested in have a "standard" commandline tools for
parsing and validating xml (and html/sgml as a bonus) on my linux
system, and also win32 wouldn't hurt, as I'm frequently using both. I
say command line because I can configure my editor to use it for
checking (it lets me set a path for any validators, compilers, parsers,
etc. Would be great if I could just check HTML and XML documents on the
fly like I can with, say, Perl or c.)

The reason I'm asking is doing a google search on google for XML parser
gave me many useless results, and it's rather hard to tell which one
realy does things right (conforming to standards.)

Thanks.
 
G

Guest

Stan said:
Could you please tell what the standard XML tools are (name) ? I am
particularly interested in have a "standard" commandline tools for
parsing and validating xml (and html/sgml as a bonus) on my linux
system, and also win32 wouldn't hurt, as I'm frequently using both. I

http://xmlsoft.org/xmllint.html
 
J

Joe Kesselman

Stan said:
Could you please tell what the standard XML tools are (name) ?

Any SAX or DOM parser. XSLT. Anything else built around the XML
specifications.
particularly interested in have a "standard" commandline tools for
parsing and validating xml (and html/sgml as a bonus) on my linux
system, and also win32 wouldn't hurt, as I'm frequently using both.

I generally use Apache Xerces as my parser, unless I've got a Good
Reason for doing something different. Your milage may vary.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,002
Messages
2,570,261
Members
46,858
Latest member
FlorrieTuf

Latest Threads

Top