question about XML and DTD


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers question about XML and DTD
# 1  
Old 04-09-2008
question about XML and DTD

Hi,

Got stuck with this.

I have a xml file which contains entities like "pound", "hellip" since these are non standard entities, xmllint fails to validate the XML file.

So, I created a DTD file with the external entities in place, once the DTD is provided as internal DTD to the XML file, the validation is smooth.

How do I achieve the same result with the DTD as an external one ?

I wont be unable to use internal DTD as I can't change the source file.

Is there any way to pass DTD as argument to xmllint and make the validation smoother ?

I tried with the options of xmllint and other web links but still fighting.

Could you please throw upon some light on this ?

Thanks
# 2  
Old 04-09-2008
Di you try xmllint --dtdattr <filename> to load external DTD files? For external DTD files to work they still have to declared inside your xml file:
Code:
<!DOCTYPE mydtd SYSTEM "mydtd.dtd">

Right? Are you not allowed to add this?
# 3  
Old 04-10-2008
hi jim,

thanks for the reply

if the DTD is included in the source file
and with either of the xmllint commands

Code:
xmllint --noout --loaddtd file.xml

or

Code:
xmllint --noout --dtdattr file.xml

it works perfectly as expected

but in either of the case, source file needs to be modified which is not possible in my case

So, is there any other way to use the dtd in the command line ( as an external dtd ) and not to alter the source file
# 4  
Old 04-10-2008
I must be missing something --dtdattr <external DTD resource file>
does not work? Kinda like telling xmllint to use what amounts to an externally defined schema?
# 5  
Old 04-10-2008
No way you can create a temp file with the DTD inlined? You will know exactly what you added, so if it validates, the original was valid, too.

(Workaround zone here. More properly, if there is no way to persuade xmllint to read an external DTD then it's really time to find, or write, a tool which can do that.)
# 6  
Old 04-11-2008
thanks for the reply era.

I had the approach you proposed already Smilie

But the sad truth is I won't be able to create temp file as well.

Am just searching for a solution where I the source file would be untouched, no temp files created and if possible to pass the external dtd as an argument to xmllint.

thanks for the reply ! Smilie
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to pull multiple XML tags from the same XML file in Shell.?

I'm searching for the names of a TV show in the XML file I've attached at the end of this post. What I'm trying to do now is pull out/list the data from each of the <SeriesName> tags throughout the document. Currently, I'm only able to get data the first instance of that XML field using the... (9 Replies)
Discussion started by: hungryd
9 Replies

2. Shell Programming and Scripting

Split xml file into multiple xml based on letterID

Hi All, We need to split a large xml into multiple valid xml with same header(2lines) and footer(last line) for N number of letterId. In the example below we have first 2 lines as header and last line as footer.(They need to be in each split xml file) Header: <?xml version="1.0"... (5 Replies)
Discussion started by: vx04
5 Replies

3. Shell Programming and Scripting

Xml multi parse question

awk -F "" '/<Id>|<id>|<Source>|<source>|<Accession>|<accession>|<TestName>|<testname>/ {print $2, $3}' OFS='\t' Test.xml The above code works great, but lets say I wanted the <Analyte> name (<Name>STAT3). The word <name> is unique so there will be multiple records pulled. Is there a way to... (8 Replies)
Discussion started by: cmccabe
8 Replies

4. Shell Programming and Scripting

How to add Xml tags to an existing xml using shell or awk?

Hi , I have a below xml: <ns:Body> <ns:result> <Date Month="June" Day="Monday:/> </ns:result> </ns:Body> i have a lookup abc.txtt text file with below details Month June July August Day Monday Tuesday Wednesday I need a output xml with below tags <ns:Body> <ns:result>... (2 Replies)
Discussion started by: Nevergivup
2 Replies

5. Shell Programming and Scripting

Shell Command to compare two xml lines while ignoring xml tags

I've got two different files and want to compare them. File 1 : HTML Code: <response ticketId="944" type="getQueryResults"><status>COMPLETE</status><description>Query results fetched successfully</description><recordSet totalCount="1" type="sms_records"><record... (1 Reply)
Discussion started by: Shaishav Shah
1 Replies

6. Shell Programming and Scripting

Scripting question, replacement in xml file

Hi Anybody can help me to make a script that replace string "Su saldo es" with "Your balance" in XML block if it start with Text Id=98 and Text Id= 12 only sample of part of file below <Text Id="98"> <Language id="1">Su saldo es $mainAccountBalance1Tiene ademas $dedicatedAccount1Balance1... (13 Replies)
Discussion started by: Ashu_099
13 Replies

7. Shell Programming and Scripting

How to add the multiple lines of xml tags before a particular xml tag in a file

Hi All, I'm stuck with adding multiple lines(irrespective of line number) to a file before a particular xml tag. Please help me. <A>testing_Location</A> <value>LA</value> <zone>US</zone> <B>Region</B> <value>Russia</value> <zone>Washington</zone> <C>Country</C>... (0 Replies)
Discussion started by: mjavalkar
0 Replies

8. AIX

ikedb XML DTD and sample files

Can anybody send me a copy of the XML DTD files of IKE database and sample XML files which are used by ikedb for manipulation of IPsec SPD/SAD? I suppose it should be under /usr/samples/ipsec. Thanks! (1 Reply)
Discussion started by: arrowheart
1 Replies

9. Shell Programming and Scripting

How to remove xml namespace from xml file using shell script?

I have an xml file: <AutoData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <Table1> <Data1 10 </Data1> <Data2 20 </Data2> <Data3 40 </Data3> <Table1> </AutoData> and I have to remove the portion xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" only. I tried using sed... (10 Replies)
Discussion started by: Gary1978
10 Replies
Login or Register to Ask a Question