Page 1 of 1

"Regular Expression to Match Output" not working f

Posted: Wed Apr 23, 2008 1:28 pm
by PeterB
I want to use the XML parser "xmlwf" from James Clark. It works for me, but, the match output isn't working for me. When I click to the left of a problem line in my text output window, it just beeps at me. It doesn't take me to the line in the file. I've tried all of the examples in the TextPad documentation.

Thanks,
Peter

Posted: Thu Apr 24, 2008 12:32 pm
by ben_josephs
In order for anyone to be able to help you, you need to provide some samples of typical error output from this application.

Regular Expression to match output not working.

Posted: Thu Apr 24, 2008 1:55 pm
by PeterB
These two lines are what I get when I parse an XML file that I've purposely removed a portion of a closing element.


I:\DTR\XML>c:\sgml\xml\expat\bin\xmlwf.exe I:\DTR\XML\dtr80424.xml
I:\DTR\XML\dtr80424.xml:11:2: mismatched tag

The "mismatched tag" is shown, obviously. But, when I click on that line, it doesn't take me into the original file where the error is. That's what I want it to do.

Thanks.

Posted: Thu Apr 24, 2008 2:13 pm
by ben_josephs
Where is the error? Is it on line 11 at column 2?

Posted: Thu Apr 24, 2008 2:17 pm
by PeterB
Yes, It's here, line 11 of the original file. It's not character 2, but, line 11 is close enough. I want it to go to the offending line.

line 11 </publication.>
There should be the word "date" after the period in "publication."

Posted: Thu Apr 24, 2008 2:24 pm
by ben_josephs
Select Posix regular expression syntax:
Configure | Preferences | Editor

[X] Use POSIX regular expression syntax
Then try
Regular expression to match output: ^(..[^:]*):([0-9]+):([0-9]+):

Registers:
File: 1
Line: 2
Column: 3

Regular Expression Finds

Posted: Fri Apr 25, 2008 12:19 pm
by PeterB
Thanks, Ben.
Sorry. I never got an e-mail that you'd responded here again. Yes, I always have POSIX turned on. Your regex works for me. Meaning, it does take me into the file where the "error" is. Now, it takes me to the wrong line entirely, though. For testing, I simply took out a close tag for a heading at the top of a file. When I parsed it and went to the error, it took me hundreds of lines down, to where the <document> ends at </document>. Is this normal?

Thanks a lot,
Peter

Posted: Fri Apr 25, 2008 1:47 pm
by ben_josephs
No. it's not normal. What exactly was the error message line you clicked on, and what line number did it take you to?

Posted: Fri Apr 25, 2008 1:58 pm
by PeterB
Here's my output:
I:\DTR\XML>c:\sgml\xml\expat\bin\xmlwf.exe I:\DTR\XML\dtr80417.xml
I:\DTR\XML\dtr80417.xml:325:2: mismatched tag

For testing, I took out the end tag for a head. I removed a </head> on line 15. As you can see above, it recognizes an error, but, it takes me to line 325! Now, I'm not that familiar with this particular xml parser. I've just read on its web site that it's not a "validating" parser. Which might explain its uselesness here. I'm trying to find out from some of my colleagues if they know of any other good "validating" xml parsers for Windows command line use.

-Peter

Posted: Fri Apr 25, 2008 2:25 pm
by ben_josephs
That's a problem with your parser. TextPad is behaving correctly.

Posted: Fri Apr 25, 2008 2:34 pm
by PeterB
Yes, you're probably right. I'm looking into it. Thanks for your help.