/* $Id: xml_select.c,v 1.67 2005/01/07 02:02:13 mgrouch Exp $ */ /* XMLStarlet: Command Line Toolkit to query/edit/check/transform XML documents Copyright (c) 2002-2004 Mikhail Grushinskiy. All Rights Reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "config.h" #include #include #include #include "trans.h" #include "stack.h" /* * TODO: * * 1. free memory (check for memory leaks) * 2. --nonet option (to disable fetching DTD over network) */ #define MAX_XSL_BUF 256*1024 #define MAX_NS_ARGS 256 char xsl_buf[MAX_XSL_BUF]; typedef struct _selOptions { int printXSLT; /* Display prepared XSLT */ int printRoot; /* Print root element in output (if XML) */ int outText; /* Output is text */ int indent; /* Indent output */ int noblanks; /* Remove insignificant spaces from XML tree */ int no_omit_decl; /* Print XML declaration line */ int nonet; /* refuse to fetch DTDs or entities over network */ const char *encoding; /* the "encoding" attribute on the stylesheet's */ } selOptions; typedef selOptions *selOptionsPtr; /* * usage string chunk : 509 char max on ISO C90 */ static const char select_usage_str_1[] = "XMLStarlet Toolkit: Select from XML document(s)\n" "Usage: xml sel {